

import java.io.IOException;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.catalina.Session;

import controller.BusinessDelegate;
import entity.Club;

public class BuscadorSVL extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private BusinessDelegate bdel = BusinessDelegate.getInstancia() ;
	
    public BuscadorSVL() {
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	doPost(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	

	obtenerClubes(request, response);
	
	}

	private void obtenerClubes(HttpServletRequest request, HttpServletResponse response) {
		Session session = (Session) request.getSession(true);
		List<Club> clubes = bdel.VerClubes();
		
		RequestDispatcher dispatcher = request.getRequestDispatcher("/Buscador.jsp");
		request.setAttribute("clubes", clubes);
		
		try {
			dispatcher.forward(request, response);
		} catch (ServletException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
